package org.ala.tiktools.rpc.netty.handler.terminate;

import org.ala.tiktools.rpc.msg.RpcMsgHead;
import org.ala.tiktools.rpc.msg.terminate.RpcTerminateMsg;
import org.ala.tiktools.rpc.netty.handler.IRpcMsgDecoderEncoder;

import io.netty.buffer.ByteBuf;

/**
 * @author ala
 * @date 2025-04-10 02:14
 */
public class RpcTerminateMsgDecoderEncoder implements IRpcMsgDecoderEncoder<RpcTerminateMsg> {
    /**
     *
     */
    public static RpcTerminateMsgDecoderEncoder INSTANCE = new RpcTerminateMsgDecoderEncoder();


    @Override
    public RpcTerminateMsg decode(RpcMsgHead head, ByteBuf in) {
        return RpcTerminateMsg.build();
    }

    @Override
    public void encoder(RpcTerminateMsg msg, ByteBuf out) {
        out.writeLong(msg.getHead().getId());
        out.writeInt(msg.getHead().getType().getVal());
        out.writeInt(0);
    }
}
